<script>
export default {
  setup() {
    console.log("setup函数执行");
    const message = "this is setup";
    const logMessage = () => {
      // vue3中这里不可以使用this,就算你打印this,它也是undefined
      console.log(this);
      alert(message)
    };
    return {
      message,
      logMessage,
    };
  },
  beforeCreate() {
    console.log("beforeCreate函数执行");
  },
};
</script>

<template>
  <div>
    <h1>{{ message }}</h1>
    <button @click="logMessage">log message</button>
  </div>
</template>

<style scoped>
</style>
